#include "lclog.h"
char g_szluaFilePath[512] = {0};
void initluaPath(char * pPathDir,char * pFileName)
{
	sprintf(g_szluaFilePath,"%s\\%s",pPathDir,pFileName);
	return ;
}
void luaout(char * data)
{
	HANDLE hMutex; 
	hMutex = CreateMutexA( 
		NULL,                       // default security attributes
		FALSE,                      // initially not owned
		"log");
	::WaitForSingleObject(hMutex,INFINITE);
	if (!strlen(g_szluaFilePath))
	{
		return;
	}
	FILE * file = fopen(g_szluaFilePath,"a");
	if(file)
	{
		fprintf(file,"%s",data);
		fclose(file);
	}
	::ReleaseMutex(hMutex);
	CloseHandle(hMutex);
}
void mylua(char * format,...)
{
	va_list arg_ptr;

	va_start(arg_ptr, format);
	char szData[1000] = {0};
	vsprintf(szData, format, arg_ptr);
	luaout(szData);
	va_end(arg_ptr);
}

